<!-- File: app/views/ProjectContracts/index.ctp -->
<div class="row-fluid sortable">		
	<div class="box span12">
		<div class="box-header" data-original-title>
			<h2><i class="icon-folder-close"></i><span class="break"></span>ProjectContracts List</h2>
			<div class="box-icon">
				<?php echo $this->Html->link('<i class="icon-plus"></i>', array('controller' => 'ProjectContracts', 'action' => 'add'), array('escape' => FALSE)); ?>
				<?php echo $this->Html->link('<i class="halflings-icon remove"></i>', array('controller' => 'ProjectContracts', 'action' => 'index'), array('escape' => FALSE)); ?>
			</div>
		</div>
		
		<div class="box-content">
			<table class="table table-striped table-bordered bootstrap-datatable datatable">
		  		<tr>
					<th>Contract Number</th>
					<th>Contract Name</th>
					<th>Begin Date</th>
					<th>End Date</th>
					<th>Status</th>
					<th colspan="2" style="text-align: center;">Tools</th>
				</tr>
					
				  <?php foreach ($project_contracts as $data): ?>
				  <?php 
				    if($data['ProjectContract']['contract_status']==1)
				    {
				    	echo ("<tr class='success'>");
				    }else if ($data['ProjectContract']['contract_status']==2)
				    {
				    	echo ("<tr class='warning'>");
				    }else
				    {
				    	echo ("<tr class='error'>");
				    }
				    ?>
				    <td><?php echo $data['ProjectContract']['contract_number']; ?></td>
				    <td>
 				    <?php 
 				      echo $this->Html->link($data['ProjectContract']['contract_name'],
 				      array('controller' => 'ProjectContracts', 'action' => 'view_detail', 
 				      $data['ProjectContract']['contract_id']));
 				    ?>
				    </td>
				    <td><?php echo (!empty($data['ProjectContract']['begin_date'])?$data['ProjectContract']['begin_date']:"Not yet"); ?></td>
				    <td><?php echo (!empty($data['ProjectContract']['end_date'])?$data['ProjectContract']['end_date']:"Not yet"); ?></td>
				    <td>
				    <?php 
				    if($data['ProjectContract']['contract_status']==1)
				    {
				    	echo ("<span class='label label-success'>New</span>");
				    }else if ($data['ProjectContract']['contract_status']==2)
				    {
				    	echo ("<span class='label label-important'>Process</span>");
				    }else
				    {
				    	echo ("<span class='label label-danger'>Closed</span>");
				    }
				    ?>
				    </td>
				    
				    
				    <td><?php echo $this->Html->link('<i class="icon-edit"></i> EDIT',array('action' => 'edit', $data['ProjectContract']['contract_id']),array('escape' => FALSE));?></td>
				    <td><?php echo $this->Html->link('<i class="icon-remove"></i> DEL',array('action' => 'delete', $data['ProjectContract']['contract_id']),array('escape' => FALSE),'Are you sure?')?></td>
				  </tr>
				  <?php endforeach; ?>
		  	</table> 
		  	<div class='pagination pagination-right'>
			  	<ul>
			  		<li><span><?php echo " Page ".$this->Paginator->counter();?></span></li>
				  	<li><?php echo $this->Paginator->first(' First ', null, null, array('class' => 'disabled'));?></li>
				  	<li><?php echo $this->Paginator->prev(' Prev ', null, null, array('class' => 'disabled'));?></li>
				  	<li><?php echo $this->Paginator->numbers(array('separator' => '','first'=>false));?></li>
				  	<li><?php echo $this->Paginator->next(' Next ', null, null, array('class' => 'disabled'));?></li>
				  	<li><?php echo $this->Paginator->last(' Last ', null, null, array('class' => 'disabled'));?></li>
			 	</ul>
			 	
			<?php 
			?>
			</div>
		  	
			<?php //echo $this->Form->submit('Create New User',array('controller' => 'ProjectContracts', 'action' => 'add'));?>	
			<?php //echo $this->Html->link('Create New User', array('controller' => 'ProjectContracts', 'action' => 'add'),array('class'=>'btn btn-primary')); ?>
		</div>
	</div><!--/span-->

</div><!--/row-->

